state 'hunger': 
  match-true: /^You are hungry\.$/ ;
  match-false: /^You are full\.$/ ;
  good: no ;
  become-true: eat-food ;
  become-false: wait ;
;

goal 'wait':
  priority: 0 ;
  achieve: active-goals 0 > ;
;

# attributes can have accessors, or not.

attribute 'carrying-edible': 
  get: body {edible} scan-contents ;
;

attribute 'destination';

goal 'eat-food': 
  priority: 10 ;
  achieve: "eat [carrying-edible]" do # expression interpolation
           hunger ;
  achieve: get-food
           retry-goal ;
;

goal 'get-food':
  priority: 9 ;
  achieve: "get food; get bread; get apple" do
           carrying-edible ;
  achieve: "buy bread" do
           carrying-edible ;
  achieve: "city.bakery" set-destination
           go-to-destination
           retry-goal ;
;

goal 'go-to-destination':
  priority: 3 ;
  achieve: destination path-to do
           body container "room" index-find-reverse destination eq ;
;